package com.alamhubb.idea.plugin.simpleplugin;

import com.intellij.codeInsight.AutoPopupController;
import com.intellij.codeInsight.completion.CompletionType;
import com.intellij.codeInsight.editorActions.TypedHandlerDelegate;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;

public class SimpleTypedHandler extends TypedHandlerDelegate {
    @Override
    public Result charTyped(char c, Project project, Editor editor, PsiFile file) {
        System.out.println(c);
        System.out.println("contrib loaded333");
        System.out.println(file);
        System.out.println(project);
        System.out.println(editor);
        System.out.println(file);
        if (file != null) {
            System.out.println(file.getLanguage());
            System.out.println(file.getFileType());
            System.out.println(file.getFileType().getName());
            System.out.println(file.getName());
        }
        System.out.println(file.getLanguage());
//        if (file != null && file.getLanguage().isKindOf(SimpleLanguage.INSTANCE)) {
//            CompletionTrigger.trigger(project, editor);
        AutoPopupController.getInstance(project).scheduleAutoPopup(editor);
        // 这里做你想做的事
        System.out.println("contrib loaded444");
//        }
        return Result.CONTINUE;
    }
}